﻿namespace CrossSelling.Core.Data.DataContextStorage
{
    public class DataContextFactory
    {
        public static CrossSellingEntities GetDataContext()
        {
            IDataContextStorageContainer dataContextStorageContainer = DataContextStorageFactory.CreateStorageContainer();

            CrossSellingEntities crossSellingEntities = dataContextStorageContainer.GetDataContext();

            if (crossSellingEntities == null)
            {
                crossSellingEntities = new CrossSellingEntities();
                dataContextStorageContainer.Store(crossSellingEntities);
            }

            return crossSellingEntities;
        }
    }
}
